package com.rudolphliu.dao;

import com.rudolphliu.entity.TraceBaseNode;
import org.apache.ibatis.jdbc.SQL;

public class TraceBaseNodeSqlProvider {

    public String insertSelective(TraceBaseNode record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("trace_base_node");
        
        if (record.getId() != null) {
            sql.VALUES("ID", "#{id,jdbcType=INTEGER}");
        }
        
        if (record.getSeqId() != null) {
            sql.VALUES("SEQ_ID", "#{seqId,jdbcType=VARCHAR}");
        }
        
        if (record.getCityCode() != null) {
            sql.VALUES("CITY_CODE", "#{cityCode,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaCode() != null) {
            sql.VALUES("AREA_CODE", "#{areaCode,jdbcType=VARCHAR}");
        }
        
        if (record.getSocialCreditCode() != null) {
            sql.VALUES("SOCIAL_CREDIT_CODE", "#{socialCreditCode,jdbcType=VARCHAR}");
        }
        
        if (record.getCompName() != null) {
            sql.VALUES("COMP_NAME", "#{compName,jdbcType=VARCHAR}");
        }
        
        if (record.getLegalType() != null) {
            sql.VALUES("LEGAL_TYPE", "#{legalType,jdbcType=VARCHAR}");
        }
        
        if (record.getLegalPerson() != null) {
            sql.VALUES("LEGAL_PERSON", "#{legalPerson,jdbcType=VARCHAR}");
        }
        
        if (record.getLegalId() != null) {
            sql.VALUES("LEGAL_ID", "#{legalId,jdbcType=VARCHAR}");
        }
        
        if (record.getRecordDate() != null) {
            sql.VALUES("RECORD_DATE", "#{recordDate,jdbcType=VARCHAR}");
        }
        
        if (record.getIssuingTime() != null) {
            sql.VALUES("ISSUING_TIME", "#{issuingTime,jdbcType=VARCHAR}");
        }
        
        if (record.getTermOfValidity() != null) {
            sql.VALUES("TERM_OF_VALIDITY", "#{termOfValidity,jdbcType=VARCHAR}");
        }
        
        if (record.getRecordNodeId() != null) {
            sql.VALUES("RECORD_NODE_ID", "#{recordNodeId,jdbcType=VARCHAR}");
        }
        
        if (record.getRecordNodeName() != null) {
            sql.VALUES("RECORD_NODE_NAME", "#{recordNodeName,jdbcType=VARCHAR}");
        }
        
        if (record.getAddress() != null) {
            sql.VALUES("ADDRESS", "#{address,jdbcType=VARCHAR}");
        }
        
        if (record.getLongitude() != null) {
            sql.VALUES("LONGITUDE", "#{longitude,jdbcType=DOUBLE}");
        }
        
        if (record.getLatitude() != null) {
            sql.VALUES("LATITUDE", "#{latitude,jdbcType=DOUBLE}");
        }
        
        if (record.getContacts() != null) {
            sql.VALUES("CONTACTS", "#{contacts,jdbcType=VARCHAR}");
        }
        
        if (record.getTel() != null) {
            sql.VALUES("TEL", "#{tel,jdbcType=VARCHAR}");
        }
        
        if (record.getFax() != null) {
            sql.VALUES("FAX", "#{fax,jdbcType=VARCHAR}");
        }
        
        if (record.getNodeType() != null) {
            sql.VALUES("NODE_TYPE", "#{nodeType,jdbcType=VARCHAR}");
        }
        
        if (record.getClassType() != null) {
            sql.VALUES("CLASS_TYPE", "#{classType,jdbcType=VARCHAR}");
        }
        
        if (record.getIndustryCode() != null) {
            sql.VALUES("INDUSTRY_CODE", "#{industryCode,jdbcType=VARCHAR}");
        }
        
        if (record.getIssend() != null) {
            sql.VALUES("issend", "#{issend,jdbcType=VARCHAR}");
        }
        
        if (record.getDelFlg() != null) {
            sql.VALUES("del_flg", "#{delFlg,jdbcType=INTEGER}");
        }
        
        if (record.getCreateDate() != null) {
            sql.VALUES("create_date", "#{createDate,jdbcType=BIGINT}");
        }
        
        if (record.getUpdateDate() != null) {
            sql.VALUES("update_date", "#{updateDate,jdbcType=BIGINT}");
        }
        
        if (record.getAuthId() != null) {
            sql.VALUES("AUTH_ID", "#{authId,jdbcType=VARCHAR}");
        }
        
        if (record.getIsuse() != null) {
            sql.VALUES("isUse", "#{isuse,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRegType() != null) {
            sql.VALUES("REG_TYPE", "#{regType,jdbcType=VARCHAR}");
        }
        
        if (record.getAuthName() != null) {
            sql.VALUES("AUTH_NAME", "#{authName,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.VALUES("UPDATETIME", "#{updatetime,jdbcType=VARCHAR}");
        }
        
        if (record.getBatchId() != null) {
            sql.VALUES("BATCH_ID", "#{batchId,jdbcType=VARCHAR}");
        }
        
        if (record.getCityName() != null) {
            sql.VALUES("CITY_NAME", "#{cityName,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaName() != null) {
            sql.VALUES("AREA_NAME", "#{areaName,jdbcType=VARCHAR}");
        }
        
        if (record.getNodeTypeName() != null) {
            sql.VALUES("NODE_TYPE_NAME", "#{nodeTypeName,jdbcType=VARCHAR}");
        }
        
        if (record.getClassTypeName() != null) {
            sql.VALUES("CLASS_TYPE_NAME", "#{classTypeName,jdbcType=VARCHAR}");
        }
        
        if (record.getState() != null) {
            sql.VALUES("state", "#{state,jdbcType=VARCHAR}");
        }
        
        if (record.getBusinessNum() != null) {
            sql.VALUES("business_num", "#{businessNum,jdbcType=INTEGER}");
        }
        
        if (record.getCredit() != null) {
            sql.VALUES("CREDIT", "#{credit,jdbcType=VARCHAR}");
        }
        
        if (record.getWhetherHelp() != null) {
            sql.VALUES("whether_help", "#{whetherHelp,jdbcType=VARCHAR}");
        }
        
        if (record.getMainCode() != null) {
            sql.VALUES("MAIN_CODE", "#{mainCode,jdbcType=VARCHAR}");
        }
        
        if (record.getQrCode() != null) {
            sql.VALUES("QR_CODE", "#{qrCode,jdbcType=VARCHAR}");
        }
        
        if (record.getBsState() != null) {
            sql.VALUES("bs_state", "#{bsState,jdbcType=VARCHAR}");
        }
        
        if (record.getBsScope() != null) {
            sql.VALUES("bs_scope", "#{bsScope,jdbcType=VARCHAR}");
        }
        
        if (record.getApplytime() != null) {
            sql.VALUES("applytime", "#{applytime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getReviewtime() != null) {
            sql.VALUES("reviewtime", "#{reviewtime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(TraceBaseNode record) {
        SQL sql = new SQL();
        sql.UPDATE("trace_base_node");
        
        if (record.getSeqId() != null) {
            sql.SET("SEQ_ID = #{seqId,jdbcType=VARCHAR}");
        }
        
        if (record.getCityCode() != null) {
            sql.SET("CITY_CODE = #{cityCode,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaCode() != null) {
            sql.SET("AREA_CODE = #{areaCode,jdbcType=VARCHAR}");
        }
        
        if (record.getSocialCreditCode() != null) {
            sql.SET("SOCIAL_CREDIT_CODE = #{socialCreditCode,jdbcType=VARCHAR}");
        }
        
        if (record.getCompName() != null) {
            sql.SET("COMP_NAME = #{compName,jdbcType=VARCHAR}");
        }
        
        if (record.getLegalType() != null) {
            sql.SET("LEGAL_TYPE = #{legalType,jdbcType=VARCHAR}");
        }
        
        if (record.getLegalPerson() != null) {
            sql.SET("LEGAL_PERSON = #{legalPerson,jdbcType=VARCHAR}");
        }
        
        if (record.getLegalId() != null) {
            sql.SET("LEGAL_ID = #{legalId,jdbcType=VARCHAR}");
        }
        
        if (record.getRecordDate() != null) {
            sql.SET("RECORD_DATE = #{recordDate,jdbcType=VARCHAR}");
        }
        
        if (record.getIssuingTime() != null) {
            sql.SET("ISSUING_TIME = #{issuingTime,jdbcType=VARCHAR}");
        }
        
        if (record.getTermOfValidity() != null) {
            sql.SET("TERM_OF_VALIDITY = #{termOfValidity,jdbcType=VARCHAR}");
        }
        
        if (record.getRecordNodeId() != null) {
            sql.SET("RECORD_NODE_ID = #{recordNodeId,jdbcType=VARCHAR}");
        }
        
        if (record.getRecordNodeName() != null) {
            sql.SET("RECORD_NODE_NAME = #{recordNodeName,jdbcType=VARCHAR}");
        }
        
        if (record.getAddress() != null) {
            sql.SET("ADDRESS = #{address,jdbcType=VARCHAR}");
        }
        
        if (record.getLongitude() != null) {
            sql.SET("LONGITUDE = #{longitude,jdbcType=DOUBLE}");
        }
        
        if (record.getLatitude() != null) {
            sql.SET("LATITUDE = #{latitude,jdbcType=DOUBLE}");
        }
        
        if (record.getContacts() != null) {
            sql.SET("CONTACTS = #{contacts,jdbcType=VARCHAR}");
        }
        
        if (record.getTel() != null) {
            sql.SET("TEL = #{tel,jdbcType=VARCHAR}");
        }
        
        if (record.getFax() != null) {
            sql.SET("FAX = #{fax,jdbcType=VARCHAR}");
        }
        
        if (record.getNodeType() != null) {
            sql.SET("NODE_TYPE = #{nodeType,jdbcType=VARCHAR}");
        }
        
        if (record.getClassType() != null) {
            sql.SET("CLASS_TYPE = #{classType,jdbcType=VARCHAR}");
        }
        
        if (record.getIndustryCode() != null) {
            sql.SET("INDUSTRY_CODE = #{industryCode,jdbcType=VARCHAR}");
        }
        
        if (record.getIssend() != null) {
            sql.SET("issend = #{issend,jdbcType=VARCHAR}");
        }
        
        if (record.getDelFlg() != null) {
            sql.SET("del_flg = #{delFlg,jdbcType=INTEGER}");
        }
        
        if (record.getCreateDate() != null) {
            sql.SET("create_date = #{createDate,jdbcType=BIGINT}");
        }
        
        if (record.getUpdateDate() != null) {
            sql.SET("update_date = #{updateDate,jdbcType=BIGINT}");
        }
        
        if (record.getAuthId() != null) {
            sql.SET("AUTH_ID = #{authId,jdbcType=VARCHAR}");
        }
        
        if (record.getIsuse() != null) {
            sql.SET("isUse = #{isuse,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRegType() != null) {
            sql.SET("REG_TYPE = #{regType,jdbcType=VARCHAR}");
        }
        
        if (record.getAuthName() != null) {
            sql.SET("AUTH_NAME = #{authName,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.SET("UPDATETIME = #{updatetime,jdbcType=VARCHAR}");
        }
        
        if (record.getBatchId() != null) {
            sql.SET("BATCH_ID = #{batchId,jdbcType=VARCHAR}");
        }
        
        if (record.getCityName() != null) {
            sql.SET("CITY_NAME = #{cityName,jdbcType=VARCHAR}");
        }
        
        if (record.getAreaName() != null) {
            sql.SET("AREA_NAME = #{areaName,jdbcType=VARCHAR}");
        }
        
        if (record.getNodeTypeName() != null) {
            sql.SET("NODE_TYPE_NAME = #{nodeTypeName,jdbcType=VARCHAR}");
        }
        
        if (record.getClassTypeName() != null) {
            sql.SET("CLASS_TYPE_NAME = #{classTypeName,jdbcType=VARCHAR}");
        }
        
        if (record.getState() != null) {
            sql.SET("state = #{state,jdbcType=VARCHAR}");
        }
        
        if (record.getBusinessNum() != null) {
            sql.SET("business_num = #{businessNum,jdbcType=INTEGER}");
        }
        
        if (record.getCredit() != null) {
            sql.SET("CREDIT = #{credit,jdbcType=VARCHAR}");
        }
        
        if (record.getWhetherHelp() != null) {
            sql.SET("whether_help = #{whetherHelp,jdbcType=VARCHAR}");
        }
        
        if (record.getMainCode() != null) {
            sql.SET("MAIN_CODE = #{mainCode,jdbcType=VARCHAR}");
        }
        
        if (record.getQrCode() != null) {
            sql.SET("QR_CODE = #{qrCode,jdbcType=VARCHAR}");
        }
        
        if (record.getBsState() != null) {
            sql.SET("bs_state = #{bsState,jdbcType=VARCHAR}");
        }
        
        if (record.getBsScope() != null) {
            sql.SET("bs_scope = #{bsScope,jdbcType=VARCHAR}");
        }
        
        if (record.getApplytime() != null) {
            sql.SET("applytime = #{applytime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getReviewtime() != null) {
            sql.SET("reviewtime = #{reviewtime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("ID = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}